package main

import (
	"fmt"
)

//2个班，每个班3名学生，输入成绩统计各个班平均分和三个班平均分,并统计每个班及格人数
/*func main() {
	class_num := 1
	stu_num := 1
	pass_num := 0
	var stu_score float64
	var score_sum float64
	var class_score_sum float64
	for ; class_num <= 2; class_num++ {
		stu_num = 1
		pass_num = 0
		for ; stu_num <= 3; stu_num++ {
			fmt.Printf("请输入第%d班第%d名学生的成绩:", class_num, stu_num)
			fmt.Scanln(&stu_score)
			fmt.Println("你输入的成绩是：", stu_score)
			if stu_score >= 60 {
				pass_num++
			}
			score_sum += stu_score
		}
		fmt.Printf("第%d个班的平均成绩为%.2f,及格人数%d个 \n", class_num, score_sum/float64(stu_num-1), pass_num)
		class_score_sum += score_sum
		score_sum = 0

	}
	fmt.Println("两个班的学生平均成绩为：", class_score_sum/6)
}*/

//打印金字塔
/*func main() {
	var totalLevel int = 10
	//i表示层数
	for i := 1; i <= totalLevel; i++ {
		//在打印*前先打印空格,println输出时多个参数自动添加空格，结束之后自动换行
		//所以需要print，print只有两个相邻的参数都不是字符串，会在它们的输出之间添加空格
		for k := 1; k <= totalLevel-i; k++ {
			fmt.Print(" ")
		}
		//接着打印*
		for j := 1; j <= 2*i-1; j++ {
			if j == 1 || j == 2*i-1 || i == totalLevel { //加了一个判断语句，只有首尾和末行是*
				fmt.Print("*")
			} else {
				fmt.Print(" ")
			}

		}
		fmt.Println("")
	}

} */

//打印乘法口诀表
func main() {
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			fmt.Printf("%v * %v = %v \t", j, i, j*i)
		}
		fmt.Println("")
	}
}
